package com.xyw.code.authorization.server.feign;


import com.xyw.code.common.core.entity.vo.Result;
import com.xyw.code.platform.common.entity.po.SysUser;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
@Slf4j
public class SysUserProviderFallback implements FallbackFactory<SysUserProvider> {

    @Override
    public SysUserProvider create(Throwable throwable) {
        return new SysUserProvider() {
            @Override
            public Result<List<SysUser>> queryByUsername(String username) {
                log.error("获取用户失败！！！！");
                return Result.fail(new ArrayList<>());
            }
        };
    }
}
